home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2006 May / PCWMAY06.iso / Software / Freeware / First Page 2006 3.00 / fp2006-final-3.00-setup.exe / {app} / Iscripts / DHTML - Menus / scrollable-menu.izs < prev    next >
Text File  |  2005-09-02  |  8KB  |  220 lines

  1. <!NOWIZARD>
  2.  
  3. <!TITLE>Scrollable Menu Links
  4. <!/TITLE>
  5.  
  6. <!BROWSER>FF1+ IE5+ Opr7+<!/BROWSER>
  7.  
  8. <!DESCRIPTION> If you have a lot of menu links and not a lot of space, this is the script to turn to. It compacts any content into a predefined area, with the content accessible via left and right scroll buttons. Browsers other than IE 4+ or NS 4+ will simply see nothing.
  9. <!/DESCRIPTION> 
  10.  
  11. <!CATEGORY>drop down menus<!/CATEGORY>
  12.  
  13. <!SCRIPT>
  14. <!-- START OF SCRIPT -->
  15. <script type="text/javascript">
  16.  
  17. /***********************************************
  18. * Scrollable Menu Links- ⌐ Dynamic Drive DHTML code library (www.dynamicdrive.com)
  19. * Visit http://www.dynamicDrive.com for hundreds of DHTML scripts
  20. * This notice must stay intact for legal use
  21. ***********************************************/
  22.  
  23. //configure path for left and right arrows
  24. var goleftimage='pointer2.gif'
  25. var gorightimage='pointer.gif'
  26. //configure menu width (in px):
  27. var menuwidth=300
  28. //configure menu height (in px):
  29. var menuheight=25
  30. //Specify scroll buttons directions ("normal" or "reverse"):
  31. var scrolldir="normal"
  32. //configure scroll speed (1-10), where larger is faster
  33. var scrollspeed=6
  34. //specify menu content
  35. var menucontents='<nobr><a href="http://www.dynamicdrive.com">Dynamic Drive</a> | <a href="http://www.javascriptkit.com">JavaScript Kit</a> | <a href="http://www.codingforums.com">CodingForums.com</a> | <a href="http://www.builder.com">Builder.com</a> | <a href="http://freewarejava.com">Freewarejava.com</a></nobr>'
  36.  
  37.  
  38. ////NO NEED TO EDIT BELOW THIS LINE////////////
  39.  
  40. var iedom=document.all||document.getElementById
  41. var leftdircode='onMouseover="moveleft()" onMouseout="clearTimeout(lefttime)"'
  42. var rightdircode='onMouseover="moveright()" onMouseout="clearTimeout(righttime)"'
  43. if (scrolldir=="reverse"){
  44. var tempswap=leftdircode
  45. leftdircode=rightdircode
  46. rightdircode=tempswap
  47. }
  48. if (iedom)
  49. document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-5000">'+menucontents+'</span>')
  50. var actualwidth=''
  51. var cross_scroll, ns_scroll
  52. var loadedyes=0
  53. function fillup(){
  54. if (iedom){
  55. cross_scroll=document.getElementById? document.getElementById("test2") : document.all.test2
  56. cross_scroll.innerHTML=menucontents
  57. actualwidth=document.all? cross_scroll.offsetWidth : document.getElementById("temp").offsetWidth
  58. }
  59. else if (document.layers){
  60. ns_scroll=document.ns_scrollmenu.document.ns_scrollmenu2
  61. ns_scroll.document.write(menucontents)
  62. ns_scroll.document.close()
  63. actualwidth=ns_scroll.document.width
  64. }
  65. loadedyes=1
  66. }
  67. window.onload=fillup
  68.  
  69. function moveleft(){
  70. if (loadedyes){
  71. if (iedom&&parseInt(cross_scroll.style.left)>(menuwidth-actualwidth)){
  72. cross_scroll.style.left=parseInt(cross_scroll.style.left)-scrollspeed+"px"
  73. }
  74. else if (document.layers&&ns_scroll.left>(menuwidth-actualwidth))
  75. ns_scroll.left-=scrollspeed
  76. }
  77. lefttime=setTimeout("moveleft()",50)
  78. }
  79.  
  80. function moveright(){
  81. if (loadedyes){
  82. if (iedom&&parseInt(cross_scroll.style.left)<0)
  83. cross_scroll.style.left=parseInt(cross_scroll.style.left)+scrollspeed+"px"
  84. else if (document.layers&&ns_scroll.left<0)
  85. ns_scroll.left+=scrollspeed
  86. }
  87. righttime=setTimeout("moveright()",50)
  88. }
  89.  
  90.  
  91. if (iedom||document.layers){
  92. with (document){
  93. write('<table border="0" cellspacing="0" cellpadding="2">')
  94. write('<td valign="middle"><a href="#" '+leftdircode+'><img src="'+goleftimage+'"border=0></a> </td>')
  95. write('<td width="'+menuwidth+'px" valign="top">')
  96. if (iedom){
  97. write('<div style="position:relative;width:'+menuwidth+'px;height:'+menuheight+'px;overflow:hidden;">')
  98. write('<div id="test2" style="position:absolute;left:0;top:0">')
  99. write('</div></div>')
  100. }
  101. else if (document.layers){
  102. write('<ilayer width='+menuwidth+' height='+menuheight+' name="ns_scrollmenu">')
  103. write('<layer name="ns_scrollmenu2" left=0 top=0></layer></ilayer>')
  104. }
  105. write('</td>')
  106. write('<td valign="middle"> <a href="#" '+rightdircode+'>')
  107. write('<img src="'+gorightimage+'"border=0></a>')
  108. write('</td></table>')
  109. }
  110. }
  111.  
  112. </script>
  113. <!-- END OF SCRIPT -->
  114. <!/SCRIPT>
  115.  
  116. <!PREVIEW>
  117. <!-- START OF SCRIPT -->
  118. <script type="text/javascript">
  119.  
  120. /***********************************************
  121. * Scrollable Menu Links- ⌐ Dynamic Drive DHTML code library (www.dynamicdrive.com)
  122. * Visit http://www.dynamicDrive.com for hundreds of DHTML scripts
  123. * This notice must stay intact for legal use
  124. ***********************************************/
  125.  
  126. //configure path for left and right arrows
  127. var goleftimage='pointer2.gif'
  128. var gorightimage='pointer.gif'
  129. //configure menu width (in px):
  130. var menuwidth=300
  131. //configure menu height (in px):
  132. var menuheight=25
  133. //Specify scroll buttons directions ("normal" or "reverse"):
  134. var scrolldir="normal"
  135. //configure scroll speed (1-10), where larger is faster
  136. var scrollspeed=6
  137. //specify menu content
  138. var menucontents='<nobr><a href="http://www.dynamicdrive.com">Dynamic Drive</a> | <a href="http://www.javascriptkit.com">JavaScript Kit</a> | <a href="http://www.codingforums.com">CodingForums.com</a> | <a href="http://www.builder.com">Builder.com</a> | <a href="http://freewarejava.com">Freewarejava.com</a></nobr>'
  139.  
  140.  
  141. ////NO NEED TO EDIT BELOW THIS LINE////////////
  142.  
  143. var iedom=document.all||document.getElementById
  144. var leftdircode='onMouseover="moveleft()" onMouseout="clearTimeout(lefttime)"'
  145. var rightdircode='onMouseover="moveright()" onMouseout="clearTimeout(righttime)"'
  146. if (scrolldir=="reverse"){
  147. var tempswap=leftdircode
  148. leftdircode=rightdircode
  149. rightdircode=tempswap
  150. }
  151. if (iedom)
  152. document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-5000">'+menucontents+'</span>')
  153. var actualwidth=''
  154. var cross_scroll, ns_scroll
  155. var loadedyes=0
  156. function fillup(){
  157. if (iedom){
  158. cross_scroll=document.getElementById? document.getElementById("test2") : document.all.test2
  159. cross_scroll.innerHTML=menucontents
  160. actualwidth=document.all? cross_scroll.offsetWidth : document.getElementById("temp").offsetWidth
  161. }
  162. else if (document.layers){
  163. ns_scroll=document.ns_scrollmenu.document.ns_scrollmenu2
  164. ns_scroll.document.write(menucontents)
  165. ns_scroll.document.close()
  166. actualwidth=ns_scroll.document.width
  167. }
  168. loadedyes=1
  169. }
  170. window.onload=fillup
  171.  
  172. function moveleft(){
  173. if (loadedyes){
  174. if (iedom&&parseInt(cross_scroll.style.left)>(menuwidth-actualwidth)){
  175. cross_scroll.style.left=parseInt(cross_scroll.style.left)-scrollspeed+"px"
  176. }
  177. else if (document.layers&&ns_scroll.left>(menuwidth-actualwidth))
  178. ns_scroll.left-=scrollspeed
  179. }
  180. lefttime=setTimeout("moveleft()",50)
  181. }
  182.  
  183. function moveright(){
  184. if (loadedyes){
  185. if (iedom&&parseInt(cross_scroll.style.left)<0)
  186. cross_scroll.style.left=parseInt(cross_scroll.style.left)+scrollspeed+"px"
  187. else if (document.layers&&ns_scroll.left<0)
  188. ns_scroll.left+=scrollspeed
  189. }
  190. righttime=setTimeout("moveright()",50)
  191. }
  192.  
  193.  
  194. if (iedom||document.layers){
  195. with (document){
  196. write('<table border="0" cellspacing="0" cellpadding="2">')
  197. write('<td valign="middle"><a href="#" '+leftdircode+'><img src="'+goleftimage+'"border=0></a> </td>')
  198. write('<td width="'+menuwidth+'px" valign="top">')
  199. if (iedom){
  200. write('<div style="position:relative;width:'+menuwidth+'px;height:'+menuheight+'px;overflow:hidden;">')
  201. write('<div id="test2" style="position:absolute;left:0;top:0">')
  202. write('</div></div>')
  203. }
  204. else if (document.layers){
  205. write('<ilayer width='+menuwidth+' height='+menuheight+' name="ns_scrollmenu">')
  206. write('<layer name="ns_scrollmenu2" left=0 top=0></layer></ilayer>')
  207. }
  208. write('</td>')
  209. write('<td valign="middle"> <a href="#" '+rightdircode+'>')
  210. write('<img src="'+gorightimage+'"border=0></a>')
  211. write('</td></table>')
  212. }
  213. }
  214.  
  215. </script>
  216.  
  217. <!-- END OF SCRIPT -->
  218. <!/PREVIEW>
  219.  
  220. <!RELATED>NONE<!/RELATED>